package com.shijie.sjoj.model.pojo.base;

import com.shijie.sjoj.model.base.BasePojo;
import lombok.Getter;

/**
 * 解题完成信息类
 *
 * @author ZSJ
 */
@Getter
public class JudgedInfo implements BasePojo {

    /**
     * 解题是否通过标志
     */
    private final Boolean flag;

    /**
     * 使用的时间信息
     */
    private final Integer useTimeMill;

    /**
     * 使用的内存信息
     */
    private final Integer useMemoryKb;

    /**
     * 比较结果错误信息
     */
    private final CompareIncorrect compareIncorrect;

    private JudgedInfo(Boolean flag, Integer useTimeMill, Integer useMemoryKb, CompareIncorrect compareIncorrect) {
        this.flag = flag;
        this.useTimeMill = useTimeMill;
        this.useMemoryKb = useMemoryKb;
        this.compareIncorrect = compareIncorrect;
    }

    /**
     * 解题通过信息录入
     *
     * @param useTimeMill Integer
     * @param useMemoryKb Integer
     * @return JudgedInfo
     */
    public static JudgedInfo of(Integer useTimeMill, Integer useMemoryKb) {
        return new JudgedInfo(true, useTimeMill, useMemoryKb, null);
    }

    /**
     * 解题错误信息录入
     *
     * @return JudgedInfo
     */
    public static JudgedInfo of(CompareIncorrect compareIncorrect) {
        return new JudgedInfo(false, null, null, compareIncorrect);
    }


}
